package com.uphone.kingmall.adapter;

import android.content.Context;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.china.zhuoyue.R;
import com.uphone.kingmall.bean.OrderBean;

/**
 * <pre>
 *     author : 孙增艳
 *     e-mail : sunzengyan@outlook.com
 *     time   : 2019/2/28
 *     desc   :
 *     version: 1.0
 * </pre>
 */
public class RvOrderRefundAdapter extends BaseQuickAdapter<OrderBean.DataBean, BaseViewHolder> {

    private final Context context;

    public RvOrderRefundAdapter(Context context) {
        super(R.layout.kingmall_item_rv_order_refund);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, OrderBean.DataBean item) {
        String stateStr = "";
        switch (item.getOrderStatus()) {
           // 0已取消；1退款;2退货;3换货;4售后成功；10待付款；20待发货；30待收货；40待评价；50已完成；
            case 0:
                stateStr = "被驳回";
                break;
            case 1:
                stateStr = "退款成功";
                break;
            case 2:
                stateStr = "申请中";
                break;
        }
        helper.setText(R.id.tv_shop_name, item.getShopName())
                .setText(R.id.tv_order_state, stateStr)
                .addOnClickListener(R.id.tv_check_details);
        RecyclerView recyclerView = helper.getView(R.id.rv_goods);
        RvRefundAdapter refundAdapter = new RvRefundAdapter(context, item.getGoodslist());
        recyclerView.setLayoutManager(new LinearLayoutManager(context));
        recyclerView.setAdapter(refundAdapter);

    }
}
